<%--
 * (c)2010-2011 Andrea Caltroni (andrea.caltroni@pd.infn.it), INFN (www.infn.it)
 *
 * This file is part of the IGI Survey Portlet (from here on shortened to IGISP).
 * IGISP is free software: you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by the Free 
 * Software Foundation, either version 3 of the License, or (at your option) any 
 * later version.
 *
 * IGISP is distributed in the hope that it will be useful, but WITHOUT ANY 
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with IGISP. If not, see <http://www.gnu.org/licenses/>.
 *
--%>

<%@ include file="./init.jsp" %>

<c:set var="numSurveys" value="${fn:length(availableSurveys)}" />

<h3><spring:message code="takeSurvey.chooseSurvey.title"/></h3>

<div class="portlet-body">
<c:choose>
    <c:when test="${numSurveys > 0}">
    
	<table class="lfr-table">

		<tr>
			<th><spring:message code="survey.label.name"/></th>
            <th><spring:message code="survey.label.start"/></th>
			<th><spring:message code="survey.label.expiration"/></th>
		</tr>

        <c:forEach items="${availableSurveys}" var="survey">
			<tr>
				<td>
				    <a href="<portlet:renderURL>
				             <portlet:param name="action" value="showQuestionForUserForm"/>
				             <portlet:param name="surveyID" value="${survey.id}"/>
				             </portlet:renderURL>"> ${survey.name}</a>
				</td>
				<td align="right"><fmt:formatDate value="${survey.start}" dateStyle="medium" timeStyle="short" /></td>
                <td align="right"><fmt:formatDate value="${survey.expiration}" dateStyle="medium" timeStyle="short" /></td>
			</tr>
		</c:forEach>
	</table>
	
	</c:when>
	<c:otherwise>
	
	<spring:message code="message.noOpenSurveys"/>.
	
	</c:otherwise>
</c:choose>
</div>
